<?php

class Config extends CComponent {
	protected $_c;
	
	public function items() {
		return array(
		);
	}
	public function __get($name) {
		$names = $this->items();
		if(isset($names[$name])) {
			return isset($this->_c[$name]) 
				? $this->_c[$name] 
				: $this->_c[$name] = $names[$name];
		}
		return parent::__get($name);
	}

	public function __set($name, $value) {
		$names = $this->items();
		if(isset($names[$name])) {
			$this->_c[$name] = $value;
		} else {
			parent::__set($name, $value);
		}
	}

	public function __isset($name) {
		if(($isset = parent::__isset($name)) !== false) {
			return true;
		} else {
			$names = $this->items();
			return isset($names[$name]);
		}
	}
	
	public function mergeWith($array = array()) {
		foreach($array as $k=>$v) {
			if($k == 'class') continue;
			if(is_array($this->$k)) {
				$this->$k = array_merge($this->$k, $v);
			} else {
				$this->$k = $v;
			}
			
		}
	}
}

?>